<template>
  <div>
    <t-navbar title="写日记" :fixed="false" left-arrow @left-click="back" />
  </div>
  <t-textarea v-model="diary.content"  style="height: 300px" placeholder="请输入文字" autosize />
  <div style="margin-top: 10px">
    <t-button theme="primary" @click="tz" block>发布</t-button>
  </div>
</template>

<script setup>
import {useRouter} from "vue-router";
import {ref} from "vue";
import {post} from "../util/Request.js";
import {Toast} from "tdesign-mobile-vue";

const router = useRouter()
// const  diary =ref()({
//
// })

const diary =ref({
  content:""
})

const back = () => {
  history.back()
}
const tz=()=>{
  post("/diaries/add",diary.value).then(r=>{
    if (r.code==0){
      Toast("添加成功")
    }else {
      Toast(r.data)
    }
  })
}
</script>

<style scoped>

</style>